#ifndef LISTINGGENERATOR_H_
#define LISTINGGENERATOR_H_

#include <iostream>
#include <fstream>
#include <vector>
#include <string>

#include "Observer.h"
#include "Token.h"

#define LIST_GEN_CONSOLE_OUTPUT 1 // shoud be in Definitions.h

class ListingGenerator : public CharacterObserver, 
	public TokenObserver, public ErrorObserver
{
public:
	ListingGenerator(ScannerInterface* scanner);
	virtual ~ListingGenerator();
	
	virtual void updateCharacter(char c);
	virtual void updateToken(Token t);
	virtual void updateError(std::string errorMsg);
	
private:
	std::ofstream listingFile;
	ScannerInterface* scanner;
	//std::vector<Token> errors;
	std::vector<std::string> errors;

	int currentLine;
	int tokenCount;
	int errorCount;
	bool endOfFile;
	
	void initListing(std::string filename);
	void addError(Token t);
	void generateReport();	
};

#endif /*LISTINGGENERATOR_H_*/
